home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / Source / GENetReleaseƒ / GELibHeaders / GraphElements.h < prev    next >
Text File  |  1994-03-07  |  5KB  |  145 lines

  1. /*
  2.     GraphElements.h
  3.     
  4.     Basic Graphic Elements for release version 1.0b1
  5.     
  6.     Copyright 1994 by Al Evans. All rights reserved.
  7.     
  8.     3/7/94
  9. */
  10.  
  11. #ifndef GRAPHELEMENTS
  12. #define GRAPHELEMENTS
  13.  
  14. #include "DispCtrl.h"
  15. #include "FastBitCopies.h"
  16.  
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20.  
  21. //-------------------------------------------------------------------------------------
  22. //Simple PICT-based Graphic Element
  23. //-------------------------------------------------------------------------------------
  24.  
  25. GrafElPtr NewBasicPICT(GEWorldPtr world, OSType id, short plane, short resNum,
  26.                             short mode, short xPos, short yPos);
  27.                             
  28. //Render proc for basic PICT graphic
  29. pascal void PICTRenderProc(GrafElPtr element, GWorldPtr destGWorld);
  30.  
  31. //-------------------------------------------------------------------------------------
  32. //Scrolling Graphic Element
  33. //-------------------------------------------------------------------------------------
  34.  
  35. typedef struct {
  36.     GrafElement        baseGraphic;
  37.     short            hScroll;            //horiz scroll for each changeIntrvl
  38.     short            vScroll;            //vert scroll for each changeIntrvl    
  39.     short            totalHScroll;        //total current horizontal scroll
  40.     short            totalVScroll;        //total current vertical scroll
  41. } ScrollingGraphic, *ScrlGraphicPtr;
  42.  
  43. //Creation of PICT-based scrolling graphics
  44. GrafElPtr NewScrollingGraphic(GEWorldPtr world, OSType id, short plane, 
  45.                         short resNum, short mode, short xPos, short yPos);
  46.  
  47. //Start or stop (autoHScroll == autoVScroll == 0) auto-scrolling
  48. void AutoScrollGraphic(GEWorldPtr world, OSType elementID, 
  49.                     short interval, short autoHScroll, short autoVScroll);
  50.                     
  51. //Manually set current scroll position
  52. void SetScroll(GEWorldPtr world, OSType elementID, short hScroll, short vScroll);
  53.  
  54. //RenderProc for scrolling graphics
  55. pascal void RenderScrollingGraphic(GrafElPtr graphic, GWorldPtr destGWorld);
  56.  
  57. //AutoChangeProc for scrolling graphics
  58. pascal void ScrollGraphic(GEWorldPtr world, GrafElPtr graphic);
  59.  
  60. //-------------------------------------------------------------------------------------
  61. //Animated (frame-sequence) Graphic Element
  62. //-------------------------------------------------------------------------------------
  63.  
  64. typedef enum {singleframe=0, reciprocating, loop, oneshot} AnimSequence;
  65.  
  66. typedef struct {
  67.     GrafElement    baseGraphic;
  68.     short            currentFrame;        // number of frame now displayed
  69.     short            nFrames;            // number of frames available
  70.     AnimSequence    seq;                // type of animation
  71. } FrameSeqGraphic, *SeqGraphicPtr;
  72.  
  73.  
  74. //Creation of PICT-based multiframe graphics
  75. GrafElPtr NewAnimatedGraphic(GEWorldPtr world, OSType id, short plane, 
  76.                     short resNum, short mode, short xPos, short yPos, short nFrames);
  77.                     
  78. //Activate or deactivate (interval == 0) automatic animation 
  79. void AnimateGraphic(GEWorldPtr world, OSType elementID, 
  80.                     short interval, AnimSequence sequence);
  81.  
  82. //Manually set current frame                    
  83. void SetFrame(GEWorldPtr world, OSType elementID, short newFrame);
  84.  
  85. //Frame sequence forwards or backwards
  86. void SetAnimDirection(GEWorldPtr world, OSType elementID, Boolean forward);
  87.  
  88. //Increment or decrement current frame according to frame sequence
  89. void BumpFrame(GEWorldPtr world, OSType elementID);
  90.  
  91. //Alternate interface to BumpFrame: avoid lookup when GrafElPtr available.
  92. //Also used as AutoChangeProc for frame-based graphics
  93. pascal void PtrBumpFrame(GEWorldPtr world, GrafElPtr graphic);
  94.  
  95. //Set mirroring -- only horizontal mirroring presently supported
  96. //NOTE!! Only works for transparent FrameSeqGraphics using default BitCopyProc
  97. //and srcCopy FrameSeqGraphics which have been masked with MakeMask() (see FastBitCopies.h)
  98. void SetMirroring(GEWorldPtr world, OSType elementID, Boolean mirrorH, Boolean mirrorV);
  99.  
  100. //RenderProc for frame-changing graphics
  101. pascal void RenderFrameGraphic(GrafElPtr graphic, GWorldPtr destGWorld);
  102.  
  103.  
  104. //-------------------------------------------------------------------------------------
  105. //Simple one-line text graphic
  106. //-------------------------------------------------------------------------------------
  107.  
  108. typedef struct {
  109.     GrafElement        baseGraphic;
  110.     StringPtr        tgText;                //pointer to text
  111.     FontInfo        tgFInfo;            //FontInfo rec for text
  112.     short            tgFontNum;            //etc.
  113.     short            tgFontSize;
  114.     short            tgFontFace;
  115.     RGBColor        tgColor;            //Color for text
  116. } TextGraphic, *TextGraphicPtr;
  117.  
  118. //Create new text graphic
  119. GrafElPtr NewTextGraphic(GEWorldPtr world, OSType id, short plane,
  120.                     short xPos, short yPos, short mode,
  121.                     short fontNum, short txStyle, short size, 
  122.                     RGBColor color, StringPtr text);
  123.  
  124. //Change text of existing text graphic
  125. void SetTextGraphicText(GEWorldPtr world, OSType elementID, StringPtr newText);
  126.  
  127. //RenderProc for text graphics
  128. pascal void RenderTextGraphic(GrafElPtr graphic, GWorldPtr destGWorld);
  129.  
  130. //-------------------------------------------------------------------------------------
  131. //This Graphic Element tiles a single PICT into its (larger) animationRect
  132. //-------------------------------------------------------------------------------------
  133.  
  134. GrafElPtr NewTiledGraphic(GEWorldPtr world, OSType id, short plane, 
  135.                         short resNum, short mode, Rect destRect);
  136.                         
  137. //RenderProc for tiled graphics
  138. pascal void RenderTiledGraphic(GrafElPtr graphic, GWorldPtr destGWorld);
  139.  
  140. #ifdef __cplusplus
  141. }
  142. #endif
  143.  
  144.  
  145. #endif